import request from '@/utils/request'

// 获取所有图书
export const getAllBooks = params => {
  return request({
    method: 'GET',
    url: '/books/page/0/20'
  })
}

// 根据关键字查询图书
export const selectBookByKeyword = data => {
  return request({
    method: 'POST',
    url: '/books/search',
    data
  })
}
// 删除图书
export const delBook = id => {
  return request({
    method: 'DELETE',
    url: `/books/delete/${id}`
  })
}

// 添加图书
export const addBook = data => {
  return request({
    method: 'POST',
    url: '/books/add',
    data
  })
}
// 根据分类级别和id进行查询图书
export const getSomeBooks = (id, type) => {
  return request({
    method: 'GET',
    url: `/categories/search/${id}/${type}`
  })
}
// 根据店铺id查询图书
export const getShopBooks = id => {
  return request({
    method: 'GET',
    url: `/books/shop/${id}`
  })
}
// 修改店铺图书商家专用
export const updateShopbook = data => {
  return request({
    method: 'PUT',
    url: '/books/update',
    data
  })
}
// 显示图书评论
export const getBookComment = id => {
  return request({
    method: 'GET',
    url: `/orders/comment/${id}`
  })
}
